/**
 *  @auth: sce
 *  @date: 18-1-2
 *  @desc:
 **/

function calculator (state = {
    result: 0,
    express: ''
}, action) {
    const {type} = action;
    switch (type){
        case "equal":
            return {
                ...state
            };
        case "change":
            return {
                ...state,
                express: action.express
            };
        default:
           return state;
    }
}

export const action ={
   equalAction: () => ({
       type: "equal"
   }),
    changeAction: (express) => ({
        type: "change",
        express
    })
};

export default calculator;